package com.itheima.InnerDemo;

public abstract  class InnerDemo implements Fly {
    public static void main(String[] args) {
    //匿名内部类通过多态接收
    //等号左边是多态，接口类型引用指向子类对象
        /* Fly fly=new Fly(){
             @Override
             public void fly() {
                 System.out.println("飞飞飞");
             }
         };
         fly.fly();*/
    /*    new Fly(){
            @Override
        public void fly() {
            System.out.println("匿名内部类直接调用方法");
        }
    }.fly();*/

        Fly fly=new Fly(){
            @Override
            public void fly() {
                System.out.println("匿名内部类以形参方式传递");
            }
        };
        showFly(fly);
    }
    public static void showFly(Fly f){
        f.fly();
    }

}
